package com.fruit.dao.fruit;

import com.fruit.bean.entity.fruit.FruitStockInfo;
import com.fruit.dao.BaseRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface FruitStockRepository extends BaseRepository<FruitStockInfo, Long> {

    FruitStockInfo findFruitStockInfoByFruitTypeIdAndAndUserId(Long fruitTypeId,Long userId);

    /**
     * 小程序端获取库存列表，返回已入库的以及已生成合同的库存列表
     * @param userId 用户id
     * @return
     */
    @Query(nativeQuery = true, value = "select * from f_stock_info " +
            "where user_id = ?1 ")
    List<FruitStockInfo> listStockInfo(Long userId);
}
